package com.test.mooan.labama.bean_boom.user_info_boom;

import com.google.gson.Gson;
import com.test.mooan.labama.utils_boom.Stringutil_boom;

import org.json.JSONObject;


/**
 * 用户登录信息，只在用户手动登录时获取，自动登录不获取
 */
public class LoginInfo_boom {

    private static class Inner {
        private static LoginInfo_boom instance = new LoginInfo_boom();
    }

    private LoginInfo_boom(){}

    public static LoginInfo_boom getInstance(){
        return Inner.instance;
    }

    private String type,token,userId,isAdSource;

    public static void parse(JSONObject objJson){
        Inner.instance = new Gson().fromJson(objJson.toString(), LoginInfo_boom.class);
    }

    public String gToken() {
        return Stringutil_boom.getSafeString(token);
    }

    public String gUserId() {
        return Stringutil_boom.getSafeString(userId);
    }

    public String gType() {
        return Stringutil_boom.getSafeString(type);
    }

    public boolean gIsAdSource() {
        return Stringutil_boom.getSafeString(isAdSource).equalsIgnoreCase("YES");
    }
}
